﻿using AdminSystem.EntityFramworkCore;
using AdminSystem.Application.Dtos;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using AdminSystem.Application.Commands.LoginCommands;

namespace AdminSystem.WebAPI.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MangementController : ControllerBase
    {
        private readonly IMediator mediator;
        public MangementController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpGet]
        public async Task<APIResult<List<UserDTO>>> Login(string? userName, string? userPass)
        {
            LoginQueryCommand command = new LoginQueryCommand();
            command.UserName = userName;
            command.UserPass = userPass;
            return await mediator.Send(command);
        }
    }


}
